// import {
//   GET,
//   POST,
//   DELETE,
//   // PATCH, 
//   PUT
// } from '@/utils/request.js'
// import { ALL, OIDC, CUI } from './baseURL.js'
import { ALL, OIDC, CUI } from './baseUrl'
import request from '@/utils/request'

// export const TestSignalR = params => GET(`${CUI}/api/Hub/TestSignalR`, params).then(res => res.data)
export function TestSignalR(params) {
  return request({
    url: `${CUI}/api/Hub/TestSignalR`,
    method: 'get',
    params: params
  })
}

// export const oIdcLogin = params => POST(`${OIDC}/api/v1/Logins/Login`, params).then(res => res.data);      //本地调试  oidc-client登录
// export const oIdcExit = params => POST(`${OIDC}/api/v1/Logins/Outlogin`, params).then(res => res.data);    //本地调试   oidc-client退出

// oidc-client登录 oidc-client登录
// export const oIdcLogin = params => POST(`${OIDC}/sso/v1/Logins/Login`, params).then(res => res.data) //现场接口
export function oIdcLogin(params) {
  return request({
    // url: '/oIdc/.well-known/openid-configuration',
    url: '/oIdc/sso/v1/Logins/Login',
    method: 'post',
    data: params
  })
}
// oidc-client退出
// export const oIdcExit = params => POST(`${OIDC}/sso/v1/Logins/Outlogin`, params).then(res => res.data) //现场接口
export function oIdcExit(params) {
  return request({
    url: `${OIDC}/sso/v1/Logins/Outlogin`,
    method: 'post',
    params: params
  })
}

// 登录
// export const userLogin = params => POST('/all/api/TokenAuth/Authenticate`, params).then(res => res.data)
export function userLogin(params) {
  return request({
    // url: '/all/api/TokenAuth/Authenticate`,
    url: '/all/api/TokenAuth/Authenticate',
    method: 'post',
    params: params
  })
}
// 获取当前登录的用户权限
// export const getUserPermission = params => POST('/all/api/TokenAuth/GetMenuInfoByUserNameOrUserId`, params).then(res => res.data)
export function getUserPermission(params?) {
  return request({
    // url: '/all/api/TokenAuth/GetMenuInfoByUserNameOrUserId`,
    url: '/all/api/TokenAuth/GetMenuInfoByUserNameOrUserId',
    method: 'post',
    params: params
  })
}

// ------------  账号管理  ----------------------------------
// 获取全部账号
// export const GetAllUser = params => GET('/all/api/services/app/User/GetAllUser`, params).then(res => res.data)
export function GetAllUser(params?) {
  return request({
    url: '/all/api/services/app/User/GetAllUser',
    method: 'get',
    params: params
  })
}
// 新建用户
// export const createUser = params => POST('/all/api/services/app/User/Create`, params).then(res => res.data)
export function createUser(params) {
  return request({
    url: '/all/api/services/app/User/Create',
    method: 'post',
    params: params
  })
}
// 编辑账号
// export const editUserInfo = params => POST('/all/api/services/app/User/Update`, params).then(res => res.data)
export function editUserInfo(params) {
  return request({
    url: '/all/api/services/app/User/Update',
    method: 'post',
    params: params
  })
}
// 删除账号
// export const deleteUser = params => POST('/all/api/services/app/User/Delete`, params).then(res => res.data)
export function deleteUser(params) {
  return request({
    url: '/all/api/services/app/User/Delete',
    method: 'post',
    params: params
  })
}
// 重置密码
// export const resetUserPassword = params => POST('/all/api/services/app/User/ResetPassword`, params).then(res => res.data)
export function resetUserPassword(params) {
  return request({
    url: '/all/api/services/app/User/ResetPassword',
    method: 'post',
    params: params
  })
}

// 修改密码
// export const updateUserPassword = params => POST('/all/api/services/app/User/ChangePassword`, params).then(res => res.data)
export function updateUserPassword(params) {
  return request({
    url: '/all/api/services/app/User/ChangePassword',
    method: 'post',
    params: params
  })
}

// ------------  角色管理  ----------------------------------
// 获取角色列表
// export const GetAllRoles = params => GET('/all/api/services/app/ResourceRoleService/GetAllRoles`, params).then(res => res.data)
export function GetAllRoles(params) {
  return request({
    url: '/all/api/services/app/ResourceRoleService/GetAllRoles',
    method: 'get',
    params: params
  })
}
// 添加角色
// export const addRoles = params => POST('/all/api/services/app/ResourceRoleService/Add', params).then(res => res.data)
export function addRoles(params) {
  return request({
    url: '/all/api/services/app/ResourceRoleService/Add',
    method: 'post',
    params: params
  })
}
// 编辑角色
// export const editRoles = params => PUT('/all/api/services/app/ResourceRoleService/Update', params).then(res => res.data)
export function editRoles(params) {
  return request({
    url: '/all/api/services/app/ResourceRoleService/Update',
    method: 'put',
    params: params
  })
}
// 删除角色
// export const deleteRoles = params => DELETE('/all/api/services/app/ResourceRoleService/Delete', params).then(res => res.data)
export function deleteRoles(params) {
  return request({
    url: '/all/api/services/app/ResourceRoleService/Delete',
    method: 'delete',
    params: params
  })
}

// ------------  权限配置  ----------------------------------
// 获取全部权限菜单
// export const getAllPermission = params => GET('/all/api/services/app/ResourcePermissionService/GetAll', params).then(res => res.data)
export function getAllPermission(params?) {
  return request({
    url: '/all/api/services/app/ResourcePermissionService/GetAll',
    method: 'get',
    params: params
  })
}
// 添加权限菜单
// export const addPermission = params => POST('/all/api/services/app/ResourcePermissionService/Add', params).then(res => res.data)
export function addPermission(params) {
  return request({
    url: '/all/api/services/app/ResourcePermissionService/Add',
    method: 'post',
    params: params
  })
}
// 编辑权限菜单
// export const editPermission = params => PUT('/all/api/services/app/ResourcePermissionService/Update', params).then(res => res.data)
export function editPermission(params) {
  return request({
    url: '/all/api/services/app/ResourcePermissionService/Update',
    method: 'put',
    params: params
  })
}
// 删除权限菜单
// export const deletePermission = params => DELETE('/all/api/services/app/ResourcePermissionService/Delete', params).then(res => res.data)
export function deletePermission(params) {
  return request({
    url: '/all/api/services/app/ResourcePermissionService/Delete',
    method: 'put',
    params: params
  })
}
// 添加权限面板
// export const addPanel = params => POST('/all/api/services/app/ResourcePanelService/Add', params).then(res => res.data)
export function addPanel(params) {
  return request({
    url: '/all/api/services/app/ResourcePanelService/Add',
    method: 'post',
    params: params
  })
}
// 修改权限面板
// export const editPanel = params => PUT('/all/api/services/app/ResourcePanelService/Update', params).then(res => res.data)
export function editPanel(params) {
  return request({
    url: '/all/api/services/app/ResourcePanelService/Update',
    method: 'put',
    params: params
  })
}
// 删除权限面板
// export const deletePanel = params => DELETE('/all/api/services/app/ResourcePanelService/Delete', params).then(res => res.data)
export function deletePanel(params) {
  return request({
    url: '/all/api/services/app/ResourcePanelService/Delete',
    method: 'delete',
    params: params
  })
}

/********************************************  快捷菜单  **********************************/
// 添加快捷菜单
// export const AddSubMenu = params => POST('/all/api/services/app/FavorateSubMenuService/AddSubMenu', params).then(res => res.data)
export function AddSubMenu(params) {
  return request({
    url: '/all/api/services/app/FavorateSubMenuService/AddSubMenu',
    method: 'post',
    params: params
  })
}
// 删除快捷菜单
// export const DeleteSubMenu = params => DELETE('/all/api/services/app/FavorateSubMenuService/DeleteSubMenu', params).then(res => res.data)
export function DeleteSubMenu(params) {
  return request({
    url: '/all/api/services/app/FavorateSubMenuService/DeleteSubMenu',
    method: 'delete',
    params: params
  })
}
// 获取快捷菜单
// export const GetSubMenuByUserId = params => GET('/all/api/services/app/FavorateSubMenuService/GetSubMenuByUserId', params).then(res => res.data)
export function GetSubMenuByUserId(params) {
  return request({
    url: '/all/api/services/app/FavorateSubMenuService/GetSubMenuByUserId',
    method: 'get',
    params: params
  })
}

